In [57]:
import plotly
import plotly.plotly as py
py.sign_in('XiaodanChen','OTqpSyDvzZzhALvPlb4S')
plotly.offline.init_notebook_mode()
In [58]:
import plotly.offline as py
py.init_notebook_mode(connected=False)
import plotly.graph_objs as go
In [59]:
index = ['TfIdf+LR',
         'TfIdf+RF',
         'TfIdf+Balanced RF',
         'TfIdf+Weighted RF',
         'TfIdf+Relabel+LR',
         'TfIdf+Relabel+RF',
         'Relabel+GloVe+LSTM',
         'Relabel+GloVe+CNN+LSTM']
trace0 = go.Bar(
    x = index,
    y =[0.21,0.16,0.22,0.19,0.80,0.88,0.86,0.86],
    name ='have stance',
    marker = dict(color='rgb(49,130,189)'
    )
)
trace1 = go.Bar(
    x = index,
    y = [0.85,0.96,0.83,0.78,0.83,0.91,0.96,0.95],
    name='no stance',
    marker=dict(color='rgb(204,204,204)',)
)

data = [trace0, trace1]
layout = go.Layout(
    title='Comparison of Methods',
    xaxis=dict(tickangle=-20,tickfont=dict(size=12,color='rgb(107, 107, 107)')),
    yaxis=dict(
        title='F1 score',
        titlefont=dict(
            size=16,
            color='rgb(107, 107, 107)'
        ),
        tickfont=dict(
            size=14,
            color='rgb(107, 107, 107)'
        )
    ),
    legend=dict(
        x=0,
        y=1.0,
        bgcolor='rgba(255, 255, 255, 0)',
        bordercolor='rgba(255, 255, 255, 0)'
    ),
    barmode='group',
    bargap=0.15,
    bargroupgap=0.1
)

fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='style-bar')